Remove redundant storage of source id in Package
authorAlex Crichton <alex@alexcrichton.com>
Mon, 8 Jun 2015 17:51:29 +0000 (10:51 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Mon, 8 Jun 2015 17:51:29 +0000 (10:51 -0700)
The package already has access to the source through the stored manifest's
package ID.

src/cargo/core/package.rs
src/cargo/core/source.rs
src/cargo/ops/cargo_package.rs
src/cargo/ops/cargo_read_manifest.rs

index fa5bcc06b7c6b6f38b02893548f570034ec623f5..593190162687336a74675d671493557477294835 100644 (file)
@@ -15,7 +15,7 @@ use core::{
 use core::dependency::SerializedDependency;
 use util::{CargoResult, graph};
 use rustc_serialize::{Encoder,Encodable};
-use core::source::{SourceId, Source};
+use core::source::Source;
 
 /// Informations about a package that is available somewhere in the file system.
 ///
@@ -27,8 +27,6 @@ pub struct Package {
     manifest: Manifest,
     // The root of the package
     manifest_path: PathBuf,
-    // Where this package came from
-    source_id: SourceId,
 }
 
 #[derive(RustcEncodable)]
@@ -60,12 +58,10 @@ impl Encodable for Package {
 
 impl Package {
     pub fn new(manifest: Manifest,
-               manifest_path: &Path,
-               source_id: &SourceId) -> Package {
+               manifest_path: &Path) -> Package {
         Package {
             manifest: manifest,
             manifest_path: manifest_path.to_path_buf(),
-            source_id: source_id.clone(),
         }
     }
 
index 32076defe95759a27623d7c87b622ae440e201ca..d18010a36ef7cc69378427cbbc166b276ecb64d1 100644 (file)
@@ -12,7 +12,7 @@ use url::Url;
 use core::{Summary, Package, PackageId, Registry, Dependency};
 use sources::{PathSource, GitSource, RegistrySource};
 use sources::git;
-use util::{human, Config, CargoResult, CargoError, ToUrl};
+use util::{human, Config, CargoResult, ToUrl};
 
 /// A Source finds and downloads remote packages based on names and
 /// versions.
@@ -61,8 +61,6 @@ pub enum GitReference {
     Rev(String),
 }
 
-type Error = Box<CargoError + Send>;
-
 /// Unique identifier for a source of packages.
 #[derive(Clone, Eq, Debug)]
 pub struct SourceId {
index 07a85512e2f298774796159bc259b4cf091b4739..88965c01b0ace793a7fe9e831ece833e4933c1a3 100644 (file)
@@ -175,7 +175,7 @@ fn run_verify(config: &Config, pkg: &Package, tar: &Path)
     });
     let mut new_manifest = pkg.manifest().clone();
     new_manifest.set_summary(new_summary.override_id(new_pkgid));
-    let new_pkg = Package::new(new_manifest, &manifest_path, &new_src);
+    let new_pkg = Package::new(new_manifest, &manifest_path);
 
     // Now that we've rewritten all our path dependencies, compile it!
     try!(ops::compile_pkg(&new_pkg, None, &ops::CompileOptions {
index c765e02c9275649240989ceb660579385b4f95b0..f9027404db378cc2704a4fa1a6d9ef10ae004ab0 100644 (file)
@@ -30,7 +30,7 @@ pub fn read_package(path: &Path, source_id: &SourceId, config: &Config)
     let (manifest, nested) =
         try!(read_manifest(&data, layout, source_id, config));
 
-    Ok((Package::new(manifest, path, source_id), nested))
+    Ok((Package::new(manifest, path), nested))
 }
 
 pub fn read_packages(path: &Path, source_id: &SourceId, config: &Config)